﻿program manager;

uses
  Forms,
  MainFrm in 'MainFrm.pas' {MainForm},
  scin in 'scin.pas',
  Unit1 in 'Unit1.pas' {Form1},
  common in 'common.pas',
  DModule in 'common\DModule.pas' {dm1: TDataModule},
  GetUserFrm in 'GetUserFrm.pas' {GetUserForm},
  NewReestrFrm in 'NewReestrFrm.pas' {NewReestrForm},
  GetSprForm in 'common\GetSprForm.pas',
  ProgresFrm in 'common\ProgresFrm.pas' {ProgresForm},
  adCpuUsage in 'common\adCpuUsage.pas',
  NewPrincipFrm in 'NewPrincipFrm.pas' {NewPrincipForm},
  cmUtils in 'common\cmUtils.pas',
  SrvSaveListFrm in 'SrvSaveListFrm.pas' {SrvSaveListForm},
  SrvFltUnit in 'SrvFltUnit.pas',
  NameFrm in 'NameFrm.pas' {NameForm},
  CollectorRepFrm in 'CollectorRepFrm.pas' {CollectorRepForm},
  SchetFrm in 'SchetFrm.pas' {SchetForm},
  VolSchetFrm in 'VolSchetFrm.pas' {VolSchetForm},
  DataSetEvents in 'common\DataSetEvents.pas' {EVM: TDataModule},
  Common_sql in 'common\Common_sql.pas',
  EventRepFrm in 'EventRepFrm.pas' {EventRepForm},
  EventGrRepFrm in 'EventGrRepFrm.pas' {EventGrRepForm},
  UserFrm in 'UserFrm.pas' {UserForm},
  AddrFrm in 'AddrFrm.pas' {AddrForm},
  ETypeFrm in 'ETypeFrm.pas' {ETypeForm},
  SetGridEh in 'common\SetGridEh.pas',
  SysUtils,
  Windows,
  IniFiles,
  ShellAPI,
  ETypeEditFrm in 'ETypeEditFrm.pas' {ETypeEditForm},
  UpgradeFrm in 'UpgradeFrm.pas' {UpgradeForm},
  ChangeCollectorFrm in 'ChangeCollectorFrm.pas' {ChangeCollectorForm},
  NewReport in 'NewReport.pas' {NewRepForm},
  NewRepParamFrm in 'NewRepParamFrm.pas' {NewRepParamForm},
  AgentRepFrm in 'AgentRepFrm.pas' {AgentRepForm},
  ScanEventFrm in 'ScanEventFrm.pas' {ScanEventForm},
  MoveCollector in 'MoveCollector.pas' {MoveCollectorForm},
  NewScanEventFrm in 'NewScanEventFrm.pas' {NewScanEventForm},
  SetENoteFrm in 'SetENoteFrm.pas' {SetENoteForm},
  VirsionFrm in 'VirsionFrm.pas' {VersionForm},
  NewMPFrm in 'NewMPFrm.pas' {NewMPForm},
  GetMListFrm in 'GetMListFrm.pas' {GetMListForm},
  GetRListFrm in 'GetRListFrm.pas' {GetRListForm},
  SetPhoneFrm in 'SetPhoneFrm.pas' {SetPhoneForm},
  DistrictFrm in 'DistrictFrm.pas' {DistrictForm},
  LofinFrm in 'login\LofinFrm.pas' {LoginForm},
  UpdateA in 'update\UpdateA.pas',
  UpdScrFrm in 'update\UpdScrFrm.pas' {UpdScrForm},
  cmLoadDataSet in 'common\cmLoadDataSet.pas',
  cmXML in 'common\cmXML.pas',
  cmFileUtil in 'common\cmFileUtil.pas',
  PrincipalRepFrm in 'PrincipalRepFrm.pas' {PrincipalRepForm},
  SrvKontrFrm in 'SrvKontrFrm.pas' {SrvKontrForm},
  CollectorReportForm in 'CollectorReportForm.pas' {CollectorForm},
  WindowThread in 'common\WindowThread.pas';

{$R *.res}
  var
    Update : TUpdateApp;
    //Ini: TIniFile;

    path,curVers,newVers,uptool :string;
    upgrade :Boolean;
begin
  Update := TUpdateApp.Create;
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.Title := 'Модуль "Диспетчер"';

  if not Update.DoUpdate('update.ini') then
  begin
    //Application.HelpFile := 'DZ.chm';
    Application.CreateForm(Tdm1, dm1);
  LoginForm := TLoginForm.Create(Application);
    LoginForm.ShowModal;
    if LoginForm.ModalResult = 1 then
    begin
      LoginForm.Free;
      Update.Free;
      Application.CreateForm(TMainForm, MainForm);
      Application.CreateForm(TEVM, EVM);
      Application.Run;
    end
    else
    begin
      LoginForm.Free;
      Update.Free;
      Application.Run;
    end;
  end
  else
  begin
    Update.Free;
    Application.Run;
  end;

end.
